#include <reg52.h>
#include <intrins.h>

sbit relay = P2^3;
sbit vibrate = P3^5;
sbit D6 = P2^5;

void Delay2000ms()		//@11.0592MHz
{
	unsigned char i, j, k;

	_nop_();
	i = 15;
	j = 2;
	k = 235;
	do
	{
		do
		{
			while (--k);
		} while (--j);
	} while (--i);
}


void Beep()
{
	
	relay = 0;
	Delay2000ms();
}


void main()
{
	while(1)
	{
		if(vibrate == 0)
		{
			Beep();
		}
		else if(vibrate == 1)
		{
			relay = 1;
		}
	}
}